/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.qihoo.gamecenter.sdk.login.plugin.login.view;

import android.content.Context;
import android.text.TextUtils.TruncateAt;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AbsListView.LayoutParams;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import android.widget.TextView;
import com.qihoo.gamecenter.sdk.login.plugin.f.a;
import com.qihoo.gamecenter.sdk.login.plugin.h.c;
import com.qihoo.gamecenter.sdk.login.plugin.h.f;

public class DropDownItemView extends RelativeLayout {
    private a a;
    private ImageView b;
    private ImageView c;
    private TextView d;
    private a e;
    private String f;
    private static int g = -1;

    public static void a(Context paramContext) {
        if (g >= 0)
            return;
        g = f.a(paramContext, 40.0F);
    }

    public static int b(Context paramContext) {
        a(paramContext);
        return g;
    }

    public DropDownItemView(Context paramContext, String paramString) {
        super(paramContext);
        a(paramContext);
        this.a = a.a(paramContext);
        AbsListView.LayoutParams localLayoutParams = new AbsListView.LayoutParams(-1, g);
        setLayoutParams(localLayoutParams);
        setGravity(16);
        int i = f.a(paramContext, 8.0F);
        RelativeLayout.LayoutParams localLayoutParams1 = new RelativeLayout.LayoutParams(f.a(paramContext, 14.0F), f.a(
                paramContext, 12.0F));
        localLayoutParams1.addRule(9, -1);
        localLayoutParams1.addRule(15, -1);
        localLayoutParams1.leftMargin = i;
        this.b = new ImageView(paramContext);
        this.b.setId(e.b.ordinal());
        this.b.setLayoutParams(localLayoutParams1);
        this.b.setScaleType(ImageView.ScaleType.FIT_XY);
        this.b.setImageDrawable(this.a.a(1073741879));
        this.b.setVisibility(4);
        addView(this.b);
        RelativeLayout.LayoutParams localLayoutParams2 = new RelativeLayout.LayoutParams(f.a(paramContext, 32.0F), f.a(
                paramContext, 34.0F));
        localLayoutParams2.addRule(11, -1);
        localLayoutParams2.addRule(15, -1);
        this.c = new ImageView(paramContext);
        this.c.setId(e.d.ordinal());
        this.c.setScaleType(ImageView.ScaleType.FIT_XY);
        this.c.setLayoutParams(localLayoutParams2);
        this.c.setImageDrawable(this.a.a(1073741835));
        this.c.setOnClickListener(new View.OnClickListener() {
            public void onClick(View paramView) {
                if (DropDownItemView.a(DropDownItemView.this) == null)
                    return;
                DropDownItemView.a(DropDownItemView.this).a(DropDownItemView.b(DropDownItemView.this));
            }
        });
        this.c.setPadding(i, i, i, i);
        addView(this.c);
        RelativeLayout.LayoutParams localLayoutParams3 = new RelativeLayout.LayoutParams(-1, -2);
        localLayoutParams3.addRule(15, -1);
        localLayoutParams3.addRule(1, e.b.ordinal());
        localLayoutParams3.addRule(0, e.d.ordinal());
        localLayoutParams3.leftMargin = (localLayoutParams3.rightMargin = i);
        this.d = new TextView(paramContext);
        this.d.setSingleLine(true);
        this.d.setEllipsize(TextUtils.TruncateAt.MIDDLE);
        this.d.setLayoutParams(localLayoutParams3);
        this.d.setTextSize(1, c.h);
        this.d.setTextColor(-11421933);
        this.d.setClickable(false);
        this.d.setIncludeFontPadding(false);
        addView(this.d);
    }

    public void setDeleteUserName(a parama) {
        if (parama == null)
            return;
        this.e = parama;
    }

    public void a(String paramString1, String paramString2, a parama) {
        setDeleteUserName(parama);
        this.f = paramString1;
        if (paramString1.equals(paramString2)) {
            this.d.setTextColor(-11421933);
            this.d.setText(paramString1);
            this.b.setVisibility(0);
        }
        else {
            this.d.setText(paramString1);
            this.d.setTextColor(-16777216);
            this.b.setVisibility(4);
        }
    }

    public static abstract interface a {
        public abstract void a(String paramString);
    }
}